package com.runjian.rundo.iot.agent.iec104.manager;

import cn.hutool.core.collection.CollUtil;
import com.runjian.rundo.iot.agent.common.entity.AgentDeviceDTO;
import com.runjian.rundo.iot.agent.iec104.consts.DeviceType;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import com.runjian.rundo.iot.agent.business.manager.BaseDeviceManagerImpl;
import com.runjian.rundo.iot.agent.common.manager.DeviceManager;
import com.runjian.rundo.iot.agent.iec104.config.Iec104Properties;
import com.runjian.rundo.iot.agent.iec104.module.Iec104Device;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import java.util.List;
import java.util.Map;

/**
 * 设备管理
 *
 * @author CaoQingHua
 */
@Component
@RequiredArgsConstructor
@Slf4j
public class Iec104DeviceManager extends BaseDeviceManagerImpl<Iec104Device> implements DeviceManager<Iec104Device>, ApplicationRunner {

    private final Iec104Properties iec104Properties;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        // 添加进缓存
        this.addLocalDeviceList(iec104Properties.getDevices());
        log.info("Iec104设备加载完成,设备数据:{}", iec104Properties.getDevices());
    }

}
